import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StyleVO, StyleForm, StyleQuery } from '@/api/business/style/types';

/**
 * 查询款式管理列表
 * @param query
 * @returns {*}
 */

export const listStyle = (query?: StyleQuery): AxiosPromise<StyleVO[]> => {
  return request({
    url: '/business/style/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询款式管理详细
 * @param id
 */
export const getStyle = (id: string | number): AxiosPromise<StyleVO> => {
  return request({
    url: '/business/style/' + id,
    method: 'get'
  });
};

/**
 * 新增款式管理
 * @param data
 */
export const addStyle = (data: StyleForm) => {
  return request({
    url: '/business/style',
    method: 'post',
    data: data
  });
};

/**
 * 修改款式管理
 * @param data
 */
export const updateStyle = (data: StyleForm) => {
  return request({
    url: '/business/style',
    method: 'put',
    data: data
  });
};

/**
 * 删除款式管理
 * @param id
 */
export const delStyle = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/style/' + id,
    method: 'delete'
  });
};
